package com.itheima.d4_proxy;

public class demo01 {
    public static void main(String[] args) {
        SongJiJi songJiJi = new SongJiJi(new BaoQiang());
        songJiJi.liveShow(100);
        songJiJi.sleep();
    }
}

interface star{
    double liveShow(double money);
    void sleep();
}

class BaoQiang implements star{

    @Override
    public double liveShow(double money) {
        System.out.println("宝强参加了一场真人秀，挣了"+money+"万元");
        return money;
    }

    @Override
    public void sleep() {
        System.out.println("宝强累了，睡觉了");
    }
}

class SongJiJi implements star{

    BaoQiang baoQiang;

    public SongJiJi() {
    }

    public SongJiJi(BaoQiang baoQiang) {
        this.baoQiang = baoQiang;
    }

    @Override
    public double liveShow(double money) {
        System.out.println("宋吉吉拉了一场真人秀"+money);
        double v = baoQiang.liveShow(money * 0.8);
        System.out.println("宋吉吉把宝强的"+v+"万元存了起来");
        return v;
    }

    @Override
    public void sleep() {
        System.out.println("宋吉吉订了一间房");
        baoQiang.sleep();
        System.out.println("宋吉吉去退房");
    }
}
